<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('新增离职人员')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-quit-edit" AUTOCOMPLETE="OFF">
        <input name="id" id="id" type="hidden" th:value="${editQuitEmp.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">工号：</label>
            <div class="col-sm-8">
                <input class="form-control" id="badge" type="text" th:value="${editQuitEmp.badge}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">姓名：</label>
            <div class="col-sm-8">
                <input class="form-control" id="name" type="text" th:value="${editQuitEmp.name}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">公司名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="compName" type="text" th:value="${editQuitEmp.compName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">部门名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="depName" type="text" th:value="${editQuitEmp.depName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">岗位名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="jobName" type="text" th:value="${editQuitEmp.jobName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">入职时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="JoinDate" type="text" th:value="${editQuitEmp.JoinDate}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请离职日期：</label>
            <div class="col-sm-8">
                <input class="form-control laydate-demo-1" id="ApplyDate" name="ApplyDate" type="text"
                       th:value="${editQuitEmp.ApplyDate}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">实际离职日期：</label>
            <div class="col-sm-8">
                <input class="form-control laydate-demo-2" id="LeaveDate" name="LeaveDate" type="text"
                       th:value="${editQuitEmp.LeaveDate}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>离职类型：</label>
            <div class="col-sm-8">
                <select name="LeaveType" id="LeaveType" class="form-control"
                        th:with="type=${@dict.getType('eCD_LeaveType')}">
                    <option value="">请选择</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:selected="${editQuitEmp.LeaveType+'' == dict.dictValue}"
                            th:value="${dict.dictValue}"></option>
                </select></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>离职原因：</label>
            <div class="col-sm-8">
                <select name="LeaveReason" id="LeaveReason" class="form-control"
                        th:with="type=${@dict.getType('eCD_LeaveReason')}">
                    <option value="">请选择</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:selected="${editQuitEmp.LeaveReason+'' == dict.dictValue}"
                            th:value="${dict.dictValue}"></option>
                </select></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label "><span style="color: red; ">*</span>离职详因：</label>
            <div class="col-sm-8">
                <input class="form-control" id="lzyy" name="lzyy" type="text"
                       th:value="${editQuitEmp.lzyy}" required/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">同步解除合同：</label>
            <div class="col-sm-8">
                <select name="isEndCon" id="isEndCon" class="form-control">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${editQuitEmp.isEndCon == true}">是</option>
                    <option value="0" th:selected="${editQuitEmp.isEndCon == false || editQuitEmp.isEndCon == '' }">否
                    </option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">支付违约金：</label>
            <div class="col-sm-8">
                <select name="isPay" id="isPay" class="form-control">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${editQuitEmp.isPay == true}">是</option>
                    <option value="0" th:selected="${editQuitEmp.isPay == false || editQuitEmp.isPay == '' }">否</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">违约金：</label>
            <div class="col-sm-8">
                <input class="form-control" id="PayFee" name="PayFee" type="text"
                       th:value="${editQuitEmp.PayFee}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">支付经济补偿金：</label>
            <div class="col-sm-8">
                <select name="IsExpenses" id="IsExpenses" class="form-control">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${editQuitEmp.IsExpenses == true}">是</option>
                    <option value="0" th:selected="${editQuitEmp.IsExpenses == false || editQuitEmp.IsExpenses == '' }">否
                    </option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">经济补偿金：</label>
            <div class="col-sm-8">
                <input class="form-control" id="ExpenseFee" name="ExpenseFee" type="text"
                       th:value="${editQuitEmp.ExpenseFee}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">竞业限制：</label>
            <div class="col-sm-8">
                <select name="Iscompete" id="Iscompete" class="form-control">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${editQuitEmp.Iscompete == true}">是</option>
                    <option value="0" th:selected="${editQuitEmp.Iscompete == false || editQuitEmp.Iscompete == '' }">否
                    </option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">竞业限制金：</label>
            <div class="col-sm-8">
                <input class="form-control" id="competeFee" name="competeFee" type="text"
                       th:value="${editQuitEmp.competeFee}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否黑名单：</label>
            <div class="col-sm-8">
                <select name="isBlackList" id="isBlackList" class="form-control">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${editQuitEmp.isBlackList == true}">是</option>
                    <option value="0" th:selected="${editQuitEmp.isBlackList == false || editQuitEmp.isBlackList == '' }">
                        否
                    </option>
                </select>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "quitManage/quitEmpRegister";


    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });
        });

    });


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-quit-edit").serializeArray();
            var id = $("#id").val();
            //下拉框校验
            //离职类型
            var LeaveType = $("#LeaveType").val();
            //离职原因
            var LeaveReason = $("#LeaveReason").val();
            //离职详因
            var lzyy = $("#lzyy").val();
            if (LeaveType == "" || LeaveType == null) {
                $.modal.alertWarning("请选择离职类型!");
                return;
            }else if(LeaveReason == "" || LeaveReason == null){
                $.modal.alertWarning("请选择离职原因!");
                return;
            }else if(lzyy == "" || lzyy == null){
                $.modal.alertWarning("请输入离职详因!");
                return;
            }

            var ApplyDate = $("#ApplyDate").val();
            var LeaveDate = $("#LeaveDate").val();
            var isEndCon = $("#isEndCon").val();
            var isPay = $("#isPay").val();
            var PayFee = $("#PayFee").val();
            var IsExpenses = $("#IsExpenses").val();
            var ExpenseFee = $("#ExpenseFee").val();
            var Iscompete = $("#Iscompete").val();
            var competeFee = $("#competeFee").val();
            var isBlackList = $("#isBlackList").val();

            data.push({"name": "id", "value": id});
            data.push({"name": "LeaveType", "value": LeaveType});
            data.push({"name": "LeaveReason", "value": LeaveReason});
            data.push({"name": "lzyy", "value": lzyy});
            data.push({"name": "ApplyDate", "value": ApplyDate});
            data.push({"name": "LeaveDate", "value": LeaveDate});
            data.push({"name": "isEndCon", "value": isEndCon});
            data.push({"name": "isPay", "value": isPay});
            data.push({"name": "PayFee", "value": PayFee});
            data.push({"name": "IsExpenses", "value": IsExpenses});
            data.push({"name": "ExpenseFee", "value": ExpenseFee});
            data.push({"name": "Iscompete", "value": Iscompete});
            data.push({"name": "competeFee", "value": competeFee});
            data.push({"name": "isBlackList", "value": isBlackList});
            $.operate.save(prefix + "/edit", data);
        }
    }

</script>


</body>
</html>